package cn.kgc.controller.logic.system;

import cn.kgc.dao.system.smj_logDao;
import cn.kgc.pojo.Jobtitle;
import cn.kgc.pojo.Log;
import com.alibaba.fastjson.JSON;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;
import java.util.List;

@Controller
@RequestMapping("/log")
public class smj_logController {
    @Resource
    private smj_logDao sm;

    /**
     * 查看全部log日志
     * @return
     */
    @RequestMapping("/show")
    @ResponseBody
    public String getShowLog(@RequestParam("currentPage") Integer currentPage, @RequestParam("pageSize")Integer pageSize,String time,String event) {
        PageHelper.startPage(currentPage,pageSize);
        System.out.println("currentPage = " + currentPage);
        System.out.println("pageSize = " + pageSize);
        Page<Log> logs = sm.selAllLog(time,event);
        PageInfo pageInfo = new PageInfo(logs);
        System.out.println("pageInfo = " + pageInfo);
        return JSON.toJSONString(pageInfo);
    }
}
